# 安装mysql
yum -y install mysql mysql-server

# 查看mysql的状态
service mysqld status

# 开启mysql服务
systemctl start  mysqld.service

# 查看mysql的状态
service mysqld status

# 执行sql语句，更改用户的密码与远程连接设置
mysql -u root -e "ALTER USER USER() IDENTIFIED BY 'xxx'; flush privileges;"


# 初始化数据库
# 1. 创建数据库（可选）
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS test;"

# 2. 导入 SQL 文件到 test
mysql -u root -p test < ../db/test.sql


# 安装jdk
yum install -y java-1.8.0-openjdk-devel.x86_64


# 安装nodejs
yum -y install nodejs
npm config set registry https://registry.npmmirror.com


# 安装redis
yum install redis -y
systemctl start redis
systemctl status redis


# 安装 maven
yum install maven -y
mvn -version
sed -i '/<mirrors>/a \
    <mirror>\
        <id>aliyunmaven</id>\
        <mirrorOf>*</mirrorOf>\
        <name>Aliyun Maven</name>\
        <url>https://maven.aliyun.com/repository/public</url>\
    </mirror>' /etc/maven/settings.xml


# 安装 nginx
yum install nginx -y
systemctl enable nginx
systemctl start nginx
systemctl status nginx
